/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mygameframework.scenes;

/**
 *
 * @author bill
 */
public class MapDate {
    short[][] layeredMap;
    int layerSize;
    int width;
    int height;

    public MapDate(int layerSize, int width, int height) {
        this.layerSize = layerSize;
        this.width = width;
        this.height = height;
        layeredMap=new short[layerSize][width*height];
    }

    public MapDate() {
    }
    public int getValue(int x,int y,int layer){
        
        return layeredMap[layer][x+y*height];
    }
    public void setValue(short idx,int x,int y,int layer){
        layeredMap[layer][x+y*height]=idx;
    }

    public int getLayerSize() {
        return layerSize;
    }
    
    public short isContain(short idx,int x,int y){
        for(short lidx=0;lidx<layerSize;lidx++){
            if(idx==layeredMap[lidx][x+y*height])return lidx;
        }
        return -1;
    }
}
